package com.ss.common.pojo;

import java.io.Serializable;

import javax.servlet.http.HttpServletRequest;

import com.ss.common.util.MyToolUtil;

/**
 * @author shanshan
 * @date 
 */
public class BaseForm implements Serializable {

	public PageResult pageResult = new PageResult();

	public PageResult getPageResult() {
		return pageResult;
	}

	public void setPageResult(PageResult pageResult) {
		this.pageResult = pageResult;
	}

	/**
	 * 初始化分页参数,计算当期是第几页,每页显示几条数据.
	 * 
	 * @param request
	 * @param p
	 */
	public void init(HttpServletRequest request) {
		String current = MyToolUtil.convertNull(request.getParameter("current"));
		String pageSize = MyToolUtil.convertNull(request.getParameter("pageSize"));
		current = current.equals("") ? "1" : current;
		pageSize = pageSize.equals("") ? "15" : pageSize;
		this.pageResult.setCurrent(Integer.parseInt(current));
		this.pageResult.setPageSize(Integer.parseInt(pageSize));
	}
}
